import router from "@/router/index.js";
import IndexView from "@/views/IndexView.vue";

function searchClick(){
    alert("搜索成功");
}
//页面初始化事件，用于页面初始化后的准备工作实施位置
window.onload=function (){
    document.onscroll=function (){
        //为了兼容PC端（Internet),时刻获取滚动条
        let s1=document.documentElement.scrollTop;
        let s2=document.body.scrollTop;
        let scroll = s1===0 ? s2 : s1;
        
        let search =document.getElementById("fixedBox")
    
        //获取视口宽度
        let width=document.documentElement.clientWidth;
        
        if(scroll>=width*0.12){
            search.style.position='fixed';
            search.style.left='0';
            search.style.top='0';
        }
        else{
            search.style.position='static';
        }

    }
}
function findFoodList(typeId){
    if(typeId===1)
    window.location.href = 'businessList.html';//静态页面跳转
}

function Topage(typeId){
    if(typeId===1)
        router.push({name:'Index'});//静态页面跳转
    if(typeId===2)Index
        window.location.href = 'orderList.html';//静态页面跳转
    if(typeId===3)
        window.location.href = 'businessNew.html';//静态页面跳转
    if(typeId===4)
        window.location.href = 'login.html';//静态页面跳转
}

function handleClick(Num){
    //路由负责跳转
    if (Num===1)router.push('/Index')
    if(Num===2)router.push('/OrderList')
    if(Num===3)router.push('/Login')
    if(Num===4)router.push('/BusinessList')
    if(Num===4)router.push('/BusinessNew')

}